package com.neulogistics.core.substation.domain.model.aggregate;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.neulogistics.core.substation.domain.model.enumeration.PaymentType;
import com.neulogistics.core.substation.domain.model.valueobject.CourierInfo;
import com.neulogistics.core.substation.domain.model.valueobject.CustomInfo;
import com.neulogistics.core.substation.domain.model.valueobject.OrderItem;
import com.neulogistics.infrastructure.ddd.domain.seedwork.Entity;
import com.neulogistics.infrastructure.ddd.domain.seedwork.IAggregateRoot;
import lombok.Data;

import java.util.Date;
import java.util.List;

@Data
public class SubstationPayment extends Entity<Long> implements IAggregateRoot {
    /**
     * 缴款单id
     */
    private Long paymentId;

    /**
     * 缴款单类型：0:收款；1:退款
     */
    private PaymentType paymentType;

    /**
     * 所属分站id
     */
    private Integer substationId;

    /**
     * 对应任务单id
     */
    private Long taskId;

    /**
     * 配送员 {userId，name}
     */
    private CourierInfo courierInfo;

    /**
     * 订单客户信息，{客户id、客户名、客户电话}
     */
    private CustomInfo customInfo;

    /**
     * 订单项，数组[{商品id、名称、数量、单价、计量单位}]
     */
    private List<OrderItem> orderItems;

    /**
     * 总额
     */
    private Double paymentTotal;

    /**
     * 生成时间
     */
    private Date createTime;

    /**
     * 是否删除
     */
    private Integer deleted;

    public SubstationPayment() {
    }

    public SubstationPayment(Long paymentId, PaymentType paymentType,
                             Integer substationId, Long taskId,
                             CourierInfo courierInfo, CustomInfo customInfo,
                             List<OrderItem> orderItems, Double paymentTotal) {
        this.paymentId = paymentId;
        this.paymentType = paymentType;
        this.substationId = substationId;
        this.taskId = taskId;
        this.courierInfo = courierInfo;
        this.customInfo = customInfo;
        this.orderItems = orderItems;
        this.paymentTotal = paymentTotal;
    }
}
